package com.lib.common.listeners;

import com.lib.common.sms.SmsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

import javax.annotation.Resource;

/**
 * Created by ethan-liu on 2017/1/7.
 */
@Component
public class SmsListener {
    private static final Logger logger = LoggerFactory.getLogger(SmsListener.class);

    @Resource
    private SmsService smsService;

    @TransactionalEventListener
    public void handleVerifyCodeEvent(VerifyCodeEvent verifyCodeEvent) {
        smsService.sendVerifyCode(verifyCodeEvent.getCellPhoneNum(), verifyCodeEvent.getVerifyCode());
    }
}
